<?php

$mcrp = './';
include_once('functions/news.php');
include_once('functions/session.php');
include_once('skin/default.php');
include_once(MakeLangPath() . 'index.php');

$SkinTitle = 'µContest - Accueil';
	
include('skin/header.php');

if(isset($_POST['title']) == true && $mcuser->isadmin == true)
{
	CreateNews($_POST['title'], $_POST['description']);
}

?>
<div class="mc_box">
	<h3>Accueil</h3>	
	<div class="mc_box_content">
		<table id="mc_tableindex">
			<tr>
				<td colspan="2"><?php echo $lang['intro']; ?></td>
			</tr>
			<tr>
				<td style="width:30%;">
					<h3><?php echo $lang['title_last_contest']; ?></h3>
					<?php DisplayCacheContent('include/lastcontests.php', 10); ?>
				</td>
				<td style="width:70%;">
					<div>
						<h3><?php echo $lang['title_act']; ?></h3>
						
						<?php DisplayCacheContent('include/lastnews.php', 10, array('news')); ?>
						
						<br />
						<a href="archive.php" style="float: right;"><?php echo $lang['link_archive']; ?></a>
						<?php
						if($mcuser->isadmin == true)
						{
						?>
							<a href="#" onclick="ToggleDisplay('mc_addnews');return false;" style="float:right;">Ajouter une news|</a>
							<div id="mc_addnews" style="display:none;">
								<form method="post">
								<table>
									<tr>
										<td align="right">Titre :</td>
										<td><input type="text" tabindex="1" name="title" size="25" /></td>
									</tr>
									<tr>
										<td align="right">Description :</td>
										<td><textarea name="description" rows="6" cols="50" tabindex="3"></textarea></td>
									</tr>
									<tr>
										<td><input type="submit" name="send" tabindex="4" value="Envoyer" /></td>
									</tr>
								</table>
								</form>
							</div>
						<?php } ?>
					</div>
				</td>
			</tr>
			<tr>
				<td></td>
				<td>
					<div>
						<h3><?php echo $lang['title_last_validation'] ?></h3>
						<?php DisplayCacheContent('include/lastvalidations.php', 10, array('validation')); ?>
					</div>
				</td>
			</tr>
		</table>
	</div>
</div>

<?php

include('skin/footer.php');

?>